.zammad-chat {
  color: black;
  position: fixed;
  right: 30px;
  bottom: 0;
  font-size: 12px;
  width: 33em;
  height: 3.5em;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  border-radius: 5px 5px 0 0;
  will-change: bottom;
  display: none;
  flex-direction: column;
  z-index: 999;

  @media only screen and (max-width: 768px) {
    right: 0;
    width: 100%;
    border-radius: 0 !important;
    font-size: 16px !important;
  }

  &--animate {
    transition: transform 500ms;
  }
}

.zammad-chat.zammad-chat-is-loaded {
  display: flex;
  opacity: 0;
}

.zammad-chat.zammad-chat-is-shown {
  opacity: 1;
}

.zammad-chat.zammad-chat-is-open {
  height: 30em;

  @media only screen and (max-width: 768px) {
    height: 100%;
  }
}

.zammad-chat-icon {
  height: 2em;
  width: 2em;
  fill: currentColor;
  vertical-align: top;
  margin-right: 5px;
  margin-top: 4px;
}

.zammad-chat-header {
  padding: 0.5em 2.5em 0.5em 1em;
  background: hsl(203, 67%, 53%);
  color: white;
  line-height: 2.5em;
  height: 3.5em;
  box-shadow: 0 -1px rgba(0, 0, 0, 0.1), 0 1px rgba(255, 255, 255, 0.3) inset,
    0 -1px rgba(0, 0, 0, 0.1) inset, 0 1px 1px rgba(0, 0, 0, 0.13);
  position: relative;
  border-radius: 5px 5px 0 0;
  overflow: hidden;
  cursor: pointer;

  @media only screen and (max-width: 768px) {
    border-radius: 0 !important;
  }
}

.zammad-chat.zammad-chat-is-open .zammad-chat-header {
  cursor: default;
}

.zammad-chat-welcome-text {
  font-size: 1.2em;
}

.zammad-chat-header-icon {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 3.4em;
  text-align: center;
  line-height: 3.4em;
  cursor: pointer;

  &::before {
    // force the icon to align to center
    content: '';
    display: inline-block;
  }
}

.zammad-chat-header-icon-open,
.zammad-chat-header-icon-close {
  fill: currentColor;
  width: 1.6em;
  height: auto;
  vertical-align: middle;
}

.zammad-chat-header-icon-close {
  width: 1.3em;
}

.zammad-chat-header-icon-close,
.zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-open {
  display: none;
}

.zammad-chat.zammad-chat-is-open .zammad-chat-header-icon-close {
  display: inline;
}

.zammad-chat-agent {
  float: left;
}

.zammad-chat-header-controls {
  float: right;
}

.zammad-chat-agent-avatar {
  border-radius: 100%;
  margin-right: 0.6em;
  float: left;
  width: 2.5em;
}

.zammad-chat-agent-name {
  font-weight: bold;
}

.zammad-chat-agent-status {
  margin: 0.25em 1em;
  display: inline-block;
  line-height: 2em;
  padding: 0 0.7em;
  border-radius: 1em;
  background: rgba(0, 0, 0, 0.1);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

.zammad-chat-agent-status::before {
  content: '';
  background: hsl(19, 90%, 51%);
  display: inline-block;
  height: 0.9em;
  width: 0.9em;
  border-radius: 100%;
  position: relative;
  margin-right: 0.3em;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

.zammad-chat-agent-status[data-status='online']::before {
  background: hsl(145, 51%, 55%);
}

.zammad-chat-agent-status[data-status='connecting']::before {
  animation: linear connect-fade 600ms infinite alternate;
  background: hsl(41, 100%, 49%);
}

@keyframes connect-fade {
  from {
    opacity: 0.5;
    transform: scale(0.6);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.zammad-chat-modal {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 3.5em;
  margin-top: 1px;
  text-align: center;
  background: white;
  z-index: 1;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;

  &:empty {
    display: none;
  }
}

.zammad-chat-modal-text {
  font-size: 1.3em;
  line-height: 1.45;

  .zammad-chat-loading-animation {
    font-size: 0.7em;
  }

  .zammad-chat-button {
    margin-top: 1em;
    font-size: 0.8em;
  }
}

.zammad-chat-modal .zammad-chat-loading-animation {
  margin-right: 8px;
  vertical-align: middle;
}

.zammad-scroll-hint {
  background: hsl(210, 8%, 98%);
  display: flex;
  align-items: center;
  border-bottom: 1px solid hsl(0, 0%, 91%);
  padding: 7px 10px 6px;
  color: hsl(0, 0%, 60%);
  cursor: pointer;

  &.is-hidden {
    display: none;
  }
}

.zammad-scroll-hint-icon {
  fill: hsl(210, 5%, 78%);
  margin-right: 8px;
}

.zammad-chat-body {
  padding: 0.5em 1em;
  overflow: auto;
  background: white;
  flex: 1;
  display: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;

  @media only screen and (max-width: 768px) {
    height: auto;
    flex: 1;
  }
}

.zammad-chat-is-open .zammad-chat-body {
  display: block;
}

.zammad-chat-timestamp {
  text-align: center;
  color: hsl(0, 0%, 60%);
  font-size: 0.9em;
  margin: 1em 0;
}

.zammad-chat-status {
  margin: 1em 0;
  text-align: center;
}

.zammad-chat-message {
  margin: 0.5em 0;
}

.zammad-chat-message-body {
  white-space: pre-line;
  overflow-wrap: break-word;
  border-radius: 1em;
}

.zammad-chat-status-inner,
.zammad-chat-message-body {
  padding: 0.5em 1em;
  line-height: 1.4;
  background: hsl(0, 0%, 93%);
  display: inline-block;
  max-width: 70%;
  box-shadow: 0 2px rgba(255, 255, 255, 0.15) inset,
    0 0 0 1px rgba(0, 0, 0, 0.08) inset, 0 1px rgba(0, 0, 0, 0.02);
}

.zammad-chat-status-inner {
  background: #eee;
  border-radius: 0.5em;
}

.zammad-chat-message--customer {
  text-align: right;
}

.zammad-chat-message--customer + .zammad-chat-message--agent,
.zammad-chat-message--agent + .zammad-chat-message--customer {
  margin-top: 1em;
}

.zammad-chat-message--customer .zammad-chat-message-body {
  background: hsl(203, 67%, 53%);
  color: white;
}

.zammad-chat-message--unread {
  font-weight: bold;
}

.zammad-chat-message--typing .zammad-chat-message-body {
  white-space: normal;
}

.zammad-chat-loading-animation {
  display: inline-block;
}

.zammad-chat-loading-circle {
  background: hsl(0, 0%, 85%);
  border-radius: 100%;
  height: 0.55em;
  width: 0.55em;
  display: inline-block;
  animation: ease-in-out load-fade 600ms infinite alternate;
}

.zammad-chat-loading-circle + .zammad-chat-loading-circle {
  animation-delay: 0.13s;
}

.zammad-chat-loading-circle
  + .zammad-chat-loading-circle
  + .zammad-chat-loading-circle {
  animation-delay: 0.26s;
}

@keyframes load-fade {
  0% {
    opacity: 0.5;
    transform: scale(0.6);
  }

  67% {
    opacity: 1;
    transform: scale(1);
  }
}

.zammad-chat-controls {
  overflow: hidden;
  display: none;
  align-items: flex-end;
  border-top: 1px solid hsl(0, 0%, 93%);
  padding: 0;
  margin: 0;
  line-height: 1.4em;
  box-shadow: 0 1px rgba(0, 0, 0, 0.01), 0 -1px rgba(0, 0, 0, 0.02);
  position: relative;
  background: white;
}

.zammad-chat-is-open .zammad-chat-controls {
  display: flex;
}

.zammad-chat-input {
  margin: 0;
  padding: 1em 2em;
  float: left;
  max-height: 6em;
  min-height: 1.4em;
  font-family: inherit;
  line-height: 1.4em;
  font-size: inherit;
  appearance: none;
  border: none;
  background: none;
  box-shadow: none;
  box-sizing: content-box;
  outline: none;
  flex: 1;
  overflow: auto;
}

.zammad-chat-input::-webkit-input-placeholder {
  color: hsl(0, 0%, 85%);
}

.zammad-chat-button {
  appearance: none;
  font-family: inherit;
  font-size: inherit;
  line-height: initial;
  background: hsl(203, 67%, 53%);
  color: white;
  padding: 0.5em 1.2em;
  margin: 0.63em 1em;
  cursor: pointer;
  border: none;
  border-radius: 1.5em;
  box-shadow: 0 2px rgba(255, 255, 255, 0.25) inset,
    0 0 0 1px rgba(0, 0, 0, 0.1) inset, 0 1px rgba(0, 0, 0, 0.1);
  outline: none;
  display: inline-block;
}

.zammad-chat-send {
  float: right;
}

.zammad-chat-button:disabled,
.zammad-chat-input:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.zammad-chat-is-hidden {
  display: none;
}

/*
  # Flat Design
*/

.zammad-chat--flat .zammad-chat-header,
.zammad-chat--flat .zammad-chat-body {
  border: none;
}

.zammad-chat--flat .zammad-chat-header {
  box-shadow: none;
}

.zammad-chat--flat .zammad-chat-message-body {
  box-shadow: none;
}

.zammad-chat--flat .zammad-chat-agent-status,
.zammad-chat--flat .zammad-chat-button,
.zammad-chat--flat .zammad-chat-status {
  box-shadow: none;
}
